/**
 * Created on Apr 22, 2007
 */
package bsh.commands;

import java.net.URI;
import java.net.URISyntaxException;

import jvs.vfs.FileSystem;
import x.java.lang.System;
import bsh.CallStack;
import bsh.Interpreter;
/**
 * @author qiangli
 * 
 */
public class mount {

	public static String usage() {
		return "usage: mount(String mp, String uri, String options)";
	}

	public static void invoke(Interpreter env, CallStack callstack, String mp, String uri) {
		invoke(env,callstack,mp,uri,"r");
	}
	
	public static void invoke(Interpreter env, CallStack callstack, String mp,
			String uri, String options) {
			try {
				invoke(env,callstack,mp,new URI(uri),options);
			} catch (URISyntaxException e) {
				System.out().print(e);
			}
	}
	
	public static void invoke(Interpreter env, CallStack callstack, String mp,
			URI uri, String options) {
		try {
			String file = env.pathToFile(mp).toString();
			FileSystem.getFileSystem().mount(file,uri,options);
		} catch (Exception e) {
			System.out().println(e);
		}
	}
}